<?php
	$id = intval($_GET['id']);
	$dt=truyenf1_truyen_get_chuong($id);

	$data=truyenf1_get_truyen($dt['truyen_id']);
	$data['chuong']=$dt;
	if($dt['user_upload']!=''){
		$data['user']=get_user_by_username($dt['user_upload']);
	}
	$truyenId = $data['id'];
	$chuongId = $dt['id'];
	
	$alias=$_GET['alias'];
	/*if(strpos($alias,$data['truyen']['alias'])===false){
			header('HTTP/1.0 404 Not Found');
			redirect(HOME.'404.html');
			die();
	}
*/
	/*
	$carray = array(
			'truyen'=> $data['truyen']['ten'],
			'truyen_link' => url_truyen($data['truyen']['id'], $data['truyen']['alias']),
			'chuong_id' => $chuongId, 
			'chuong_link' => url_truyen_chuong($data['id'],$data['alias'], $data['truyen']['alias']),
			'tenchuong' => $data['ten']
		);

	$sc = json_encode($carray);
	setcookie("tc[$truyenId]", $sc, strtotime( '+30 days' ), '/');
*/
	
	

   	//Tinh View -------------------------
//	truyen_view($dt['truyen_id'],$id);

	$og='<meta property="og:type" content="book" />
	<meta property="og:image" content="http://sv1.mong.vn/mong/upload/'.$data['hinhanh'].'"/>
	<meta property="og:locale" content="vi_VN" /> 
	<meta property="og:title" content="Đọc Truyện '.$data['ten'].' '.$dt['ten'].' Online"/>
	<meta property="og:description" content=" '.encode($data['noidung']).'"/> 
	<meta property="og:url" content="'.url().'"/> ';
	$data1['og']=$og;
   
		//HEADER TITLE,KEYWORD,DESCRIPION
	$data1['title']=$data['ten']." ".$dt['ten'];                                  
	$data1['keyword']=$data['ten'].",".$data['ten']." ".$data['ten'].", đọc truyện ".$data['ten']." online";
	$data1['mota']="Đọc Truyện ".$data['ten']." ".$data.' Online';

loadview('template/header_truyen',$data1);
loadview("truyen/view_chuong",$data);
loadview('template/footer_truyen',$data1);
exit();



?>